const express = require('express');
const router = express.Router();


function bookRouteModule(db) {

    //得到图书列表  可传参数，当前页码，当前展示数量  默认为1，10
    router.get('/list', async (req, res) => {
        const page = parseInt(req.query.page) || 1;
        const size = parseInt(req.query.size) || 10;

        const offset = (page - 1) * size;
            
        try {
            const [totalResult] =  await db.query('SELECT COUNT(*) as total FROM books');
            
            console.log(totalResult, "totalResult");

        } catch (error) {
            
        }
        
    })

}

export default bookRouteModule;